Skip to content

test(rm): reject empty alias paths#114

Merged
overtrue merged 1 commit intomainfrom
codex/rm-empty-alias-path-gap
Apr 19, 2026
Merged

test(rm): reject empty alias paths#114
overtrue merged 1 commit intomainfrom
codex/rm-empty-alias-path-gap

Conversation

@overtrue
Copy link
Copy Markdown
Contributor

@overtrue overtrue commented Apr 12, 2026

Summary

This PR adds focused regression coverage for an untested rm parser path introduced by the recent remove-command changes.

Users can pass malformed paths like /bucket/key to rc rm. Before this change, the parser accepted that shape, produced an empty alias, and only failed later during alias lookup. That surfaced the wrong class of error and left the path-validation contract under-tested.

Root cause

parse_rm_path() validated the bucket segment but did not reject an empty alias segment. Existing tests covered missing buckets and empty input, but they did not cover a leading slash path where the alias portion is blank.

Fix

The patch keeps scope tight to crates/cli/src/commands/rm.rs:

  • reject empty aliases directly in parse_rm_path()
  • add a regression test for /mybucket/file.txt

This keeps the failure at the parser boundary and prevents malformed remove paths from falling through into later alias resolution.

Validation

I ran:

  • cargo test -p rustfs-cli test_parse_rm_path_empty_alias --lib -- --nocapture
  • cargo fmt --all --check
  • cargo clippy --workspace -- -D warnings
  • cargo test --workspace

I also ran make pre-commit per the automation instructions, but this checkout does not define that target:

text
make: *** No rule to make target pre-commit'. Stop.

@overtrue overtrue force-pushed the codex/rm-empty-alias-path-gap branch from a938e57 to e8d1b7e Compare April 19, 2026 15:10
@overtrue overtrue marked this pull request as ready for review April 19, 2026 15:12
@overtrue overtrue merged commit 218f2d2 into main Apr 19, 2026
15 checks passed
@overtrue overtrue deleted the codex/rm-empty-alias-path-gap branch April 19, 2026 15:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant